using System;
using System.Web.UI; 
using System.Web.UI.WebControls; 
using LibreriaCommon;

namespace LibreriaWC
{
    /// <summary>
    /// Clase que extiende el control ListBox.
    /// </summary>
    [ToolboxData("<{0}:lstBase runat=server></{0}:lstBase>")] 
    public class lstBase : System.Web.UI.WebControls.ListBox 
    { 
        /// <summary>
        /// Obtener el valor seleccionado convertido en Int16 (short).
        /// </summary>
        /// <returns>valor convertido a Int16 (short).</returns>
        public short GetInt16()
		{ 
			try 
			{ 
				return Convert.ToInt16(SelectedValue); 
			} 
			catch (Exception ex) 
			{ 
				ErrorLog.Log(ex);
				throw ex;
			} 
		} 
		
        /// <summary>
        /// Obtener el valor seleccionado convertido en Int32 (int).
        /// </summary>
        /// <returns>valor convertido a Int32 (int).</returns>
        public int GetInt32() 
        { 
            try 
            { 
                return Convert.ToInt32(SelectedValue); 
            } 
            catch (Exception ex) 
            { 
				ErrorLog.Log(ex);
				throw ex;
			} 
        } 

        /// <summary>
        /// Obtener el valor seleccionado convertido en Int64 (long).
        /// </summary>
        /// <returns>valor convertido a Int64 (long).</returns>
        public long GetInt64() 
        { 
            try 
            { 
                return Convert.ToInt64(SelectedValue); 
            } 
            catch (Exception ex) 
            { 
				ErrorLog.Log(ex);
				throw ex;
			} 
        } 
    }
}